<%@ page language="java" import="java.util.*,com.ruohi.util.common.*" pageEncoding="UTF-8"%><%
	String tablePrefix = Env.getInstance().getProperty("table_prefix");
	String tableName = "gift_product_ask";
	String channelUUID = CommonString.getFormatPara(request.getParameter("channel_uuid"));
	String product_no = CommonString.getFormatPara(request.getParameter("product_no"));
	String fileds = "id,add_user,add_date,uuid,pub_date,mem_no,content,content_explain,explain_date,is_show";
	String whereStr = " and product_no='" + product_no + "'";
	String orderByStr = " add_date desc ";
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title><%=Env.getInstance().getProperty("project_name") %></title>
	<link href="/plugin/ui/ligerUI/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
	<link href="/plugin/ui/ligerUI/ligerUI/skins/Gray/css/all.css" rel="stylesheet" type="text/css" />
	<link href="/plugin/ui/ligerUI/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
	<link href="/backend/style/style.css" rel="stylesheet" type="text/css" />
	<script src="/plugin/jquery/jquery.min.js" type="text/javascript"></script>
  </head>
  <body>
  	<div class="searchForm">
  		<div class="searchCondition">
  			<div class="searchList">
	        	<div class="searchLeft">提问人</div>
		  		<div class="searchRight">
		  			<input type="text" style="width: 120px;" name="mem_no" class="jr_text" id="mem_no" />
		  		</div>
	  		</div>
	  		<div class="searchList" style="width:390px;">
		  		<div class="searchLeft">提问时间</div>
		  		<div class="searchRight" style="width:300px;">
		  			<input type="text" class="Wdate jr_text" style="width:120px;" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'});" name="add_date_start" id="add_date_start" />
		  			-
		  			<input type="text" class="Wdate jr_text" style="width:120px;" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'});" name="add_date_end" id="add_date_end" />
		  		</div>
		  	</div>
		  	<div class="searchList">
		  		<div class="searchLeft">提问详情</div>
		  		<div class="searchRight">
		  			<input type="text" style="width: 120px;" name="content" class="jr_text" id="content" />
		  		</div>
	  		</div>
	  		<div class="searchList">
		  		<div class="searchLeft">是否显示</div>
		  		<div class="searchRight">
		  			<select class="jr_select" id="is_show" name="is_show" >
	                    <option value="">--请选择--</option>
	                    <option value="1">是</option>
	                    <option value="0">否</option>
	                </select>
		  		</div>
	  		</div>
  		</div>
  		<div class="searchBtn">
  			<input type="button" class="btn" onclick="doSearch();" value="查询" />
  			<input type="button" class="btn" onclick="doClearForm();" value="重置" />
  		</div>
  	</div>
	<div style="clear: left;"></div>
	<div class="l-loading" style="display: block" id="pageloading"></div> 
	<div id="maingrid" style="margin: 0; padding: 0"></div>
	<div style="display: none;"></div>
  </body>
</html>
<script src="/plugin/ui/ligerUI/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
<script src="/backend/scripts/common.js" prefix="<%=tablePrefix %>" type="text/javascript"></script>
<script type="text/javascript">
	var grid;
	var tableName = "<%=tableName %>";
	var channelUUID = '<%=channelUUID%>';
	var fields = "<%=fileds %>";
	var whereStr = "<%=whereStr %>";
	var orderBy = "<%=orderByStr %>";
	var columnsArr = [];
	var url = "";
	var conditionStr = "";
	var params = [];
	var addToolbar = {};
	jQuery(function() {
		params.push({'name':'enumNo','value':'106013','fileName':'test'});
		grid = new Dev21sunGrid({
			addToolbar:[{
				text : '刷新',
					click : function() {
						grid.loadData();
					},
					icon : 'refresh'
			}]
		});
		jQuery("#pageloading").hide();
	});
	//列数组
	columnsArr =  [ 
	{ display : '提问人', name : 'mem_no', align : 'left' , type : 'string' , width : 100 },
	{ display:"提问时间", name : 'add_date',align:"center", type:"string", width:150 },
	{ display : '提问详情', name : 'content'  , align : 'left' , type : 'string' , width : 150 },
	{ display : '回复', name : 'content_content'  , align : 'center' , type : 'string' , width : 80 , render : function(row){
		return row.content_explain==null || row.content_explain=="" ? "尚未回复" : "已回复";	
	}} ,
	{ display:"是否显示", name:"is_show", align:"center", type:"string", width:80, render:function(row){
		return row.is_show=="0" ? "不显示" : "显示";
	} },
	{ display : '操作', align : 'center', width : 80, render:function(row){
		return "<a href='javascript://void(0);' onclick='view("+row.__index+");'>查看/回复<a/>";
	} }
	];
	/*列表页条件查询*/
	function doSearch(){
		params = [];
		conditionStr = "";
		var mem_no = jQuery("#mem_no").val();
		if(''!=jQuery.trim(mem_no)){
			conditionStr += " and mem_no like '%"+mem_no+"%' ";
		}
		var add_date = jQuery("#add_date").val();
		if(''!=jQuery.trim(add_date)){
			conditionStr += " and CONVERT(varchar(100), add_date, 23) = '"+add_date+"' ";
		}
		var start_date = jQuery("#add_date_start").val();
		if(''!=jQuery.trim(start_date)){
			conditionStr += " and pub_date > '"+start_date+"' ";
		}
		var end_date = jQuery("#add_date_end").val() ;
		if(''!=jQuery.trim(end_date)){
		    conditionStr += " and pub_date < '"+end_date+"'" ;
		}
		var content = $.trim($("#content").val());
		if(content!=""){
			conditionStr += " and content like '%" + content + "%'";
		}
		var is_show = $("#is_show").val();
		if(is_show!=""){
			conditionStr += " and is_show=" + is_show;
		}
		params.push({'name':'tableName','value':tableName});
		params.push({'name':'enumNo','value':'106013'});
		params.push({'name':'fields','value':fields});
		params.push({'name':'whereStr','value':conditionStr});
		params.push({'name':'orderBy','value':orderBy});
		grid.options.parms=params;
		grid.loadData();
	}
	
	function view(index){
		var row = grid.getRow(index);
	    toolbarAdd({width:600,height:500,title:'查看提问详情'},row.uuid);
	}
	
	function doSub(){
		return true;
	}
	
	function addAndEdit(index){
		if(undefined==index){//如果是增加
			toolbarAdd({
				width:600,
				height:500,
				title:"增加",
				params : {
	    			channel_uuid : "<%=channelUUID %>",
	    			product_no : "<%=product_no %>"
	    		}
			});
		}else{//如果是修改
	    	var row = grid.getRow(index);
	    	toolbarAdd({width:600,height:500,title:'编辑'},row.uuid);
		}
    }
</script>